package com.github.bridge.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class SignDetailVO extends BaseVO {

    @Schema(description = "签署流程id")
    private String signFlowId;
    @Schema(description = "作废签署流程id")
    private String newRevokSignFlowId;
    @Schema(description = "第三方业务码（长度50）")
    private String businessNo;
    @Schema(description = "流程状态：0-草稿，1-签署中，2-已完成，3-已过期，4-已拒签，5-已作废，6-作废中，7-填写中，8-填写完成")
    private Integer signFlowStatus;
    @Schema(description = "签署流程结束时间")
    private String signFlowEndTime;
    @Schema(description = "签署流程创建时间")
    private String signFlowCreateTime;
    @Schema(description = "流程主题")
    private String subject;
    @Schema(description = "业务模板编码")
    private String businessTypeCode;
    @Schema(description = "流程备注（长度200）")
    private String remark;
    @Schema(description = "签署回调通知地址（长度500）")
    private String signNotifyUrl;
    @Schema(description = "签署完成重定向地址（长度500）")
    private String redirectUrl;
    @Schema(description = "签署截止日期：超过签署有效期后流程过期。")
    private String signFlowExpireTime;
    @Schema(description = "签署文件类型 pdf/ofd")
    private String signFileFormat;
    @Schema(description = "发起方信息集合")
    private InitiatorInfo initiatorInfo;
    @Schema(description = "抄送方信息集合")
    private List<CcInfos> ccInfos;
    @Schema(description = "流程文档信息集合")
    private List<SignFiles> signFiles;
    @Schema(description = "附件信息集合")
    private List<Attachments> attachments;
    @Schema(description = "手动发起/结束配置项，仅使用一步发起签署/无节点发起签署创建的签署流程，且流程状态=草稿时返回manualConfig")
    private ManualConfig manualConfig;
    @Schema(description = "签署方信息")
    private List<SignerInfos> signerInfos;
    @Schema(description = "填写方信息集合")
    private List<FillingUserInfos> fillingUserInfos;


    @Data
    public static class InitiatorInfo {
        @Schema(description = "发起方用户类型：1-内部，2-相对方")
        private Integer userType;
        @Schema(description = "发起方用户编码（本系统的唯一标识）")
        private String userCode;
        @Schema(description = "发起方姓名")
        private String userName;
        @Schema(description = "发起方用户账号（客户系统的唯一标识）")
        private String customAccountNo;
        @Schema(description = "发起方所属组织编码（本系统的唯一标识）")
        private String departmentCode;
        @Schema(description = "发起方所属组织账号（客户系统的唯一标识）")
        private String customDepartmentNo;
        @Schema(description = "发起方所属组织名称")
        private String departmentName;
        @Schema(description = "发起方所属企业编码（本系统的唯一标识）")
        private String organizationCode;
        @Schema(description = "发起方所属企业账号（客户系统的唯一标识）")
        private String customOrgNo;
        @Schema(description = "发起方所属企业名称")
        private String organizationName;
    }
    @Data
    public static class CcInfos {
    }
    @Data
    public static class SignFiles {
        @Schema(description = "文档模板id")
        private String docTemplateId;
        @Schema(description = "签署原文档fileKey")
        private String fileKey;
        @Schema(description = "签署原文档fileKey的文件下载地址")
        private String downloadUrl;
        @Schema(description = "签署原文档fileKey的文件下载外网地址")
        private String downloadOuterUrl;
        @Schema(description = "文档顺序,用于页面文档顺序显示")
        private String fileOrder;
        @Schema(description = "签署完成文档fileKey，仅当流程为“2-已完成”状态时返回。")
        private String signedFileKey;
        @Schema(description = "签署完成文档fileKey的文件下载地址")
        private String signDownloadUrl;
        @Schema(description = "签署完成文档fileKey的文件下载外网地址")
        private String signDownloadOuterUrl;
    }
    @Data
    public static class Attachments {
        @Schema(description = "附件fileKey")
        private String fileKey;
        @Schema(description = "文档顺序,用于页面文档顺序显示")
        private String fileOrder;
        @Schema(description = "文件下载地址")
        private String downloadUrl;
        @Schema(description = "文件下载外网地址")
        private String downloadOuterUrl;
        @Schema(description = "用户编码（本系统的唯一标识）")
        private String userCode;
        @Schema(description = "用户账号（客户系统的唯一标识）")
        private String customAccountNo;
        @Schema(description = "参与类型,0-发起人,1-签署者")
        private Integer roleType;
    }
    @Data
    public static class ManualConfig {
        @Schema(description = "签署区设置页信息集合")
        private SigningAreaPageInfos signingAreaPageInfos;

    }

    @Data
    public static class SigningAreaPageInfos {
        @Schema(description = "签署区设置页长链地址")
        private String signingAreaPageUrl;
        @Schema(description = "签署区设置页短链地址")
        private String signingAreaPageShortUrl;
    }

    @Data
    public static class SignerInfos {
        @Schema(description = "签署方用户类型：1-内部，2-相对方")
        private Integer userType;
        @Schema(description = "签署方类型：1-个人，2-企业")
        private Integer signerType;
        @Schema(description = "签署方用户编码（本系统的唯一标识）")
        private String userCode;
        @Schema(description = "签署方用户名称")
        private String userName;
        @Schema(description = "签署方用户账号（客户系统的唯一标识）")
        private String customAccountNo;
        @Schema(description = "签署印章审批ID")
        private List<String> approvalFlowIds;
        @Schema(description = "签署方所属组织编码（本系统唯一标识）")
        private String departmentCode;
        @Schema(description = "签署方所属组织账号（客户系统的唯一标识）")
        private String customDepartmentNo;
        @Schema(description = "签署方所属组织名称")
        private String departmentName;
        @Schema(description = "签署主体企业编码（本系统的唯一标识）")
        private String organizationCode;
        @Schema(description = "签署主体企业账号（客户系统的唯一标识）")
        private String customOrgNo;
        @Schema(description = "签署主体企业名称")
        private String organizationName;
        @Schema(description = "用户所在签署网络节点标识")
        private String estpNode;
        @Schema(description = "用户所在签署网络节点名称")
        private String estpNodeName;
        @Schema(description = "签署节点，最小为1。")
        private Integer signNode;
        @Schema(description = "节点内排序方式：0-顺序签，1-无序签，2-或签")
        private Integer signMode;
        @Schema(description = "节点内顺序")
        private Integer signOrder;
        @Schema(description = "可用印章介质：0-云印章及UKey印章、1-仅UKey印章、2-仅云印章。不传或传空时默认为2")
        private Integer UKeyOnly;
        @Schema(description = "签署方状态：0-待签署，1-签署中，2-已签署，3-已拒签，4-无需签署")
        private Integer signerStatus;
        @Schema(description = "签署时间")
        private String signDate;
        @Schema(description = "签署链接 流程状态=签署中时有值")
        private SignUrlInfo signUrlInfo;
        @Schema(description = "签署文档列表")
        private List<SignFileDetails> signFileDetails;
    }
    @Data
    public static class SignUrlInfo {
        @Schema(description = "签署链接地址")
        private String signUrl;
        @Schema(description = "签署链接地址（短链）")
        private String signUrlShort;
    }
    @Data
    public static class SignFileDetails {
        @Schema(description = "签署文档fileKey")
        private String fileKey;
        @Schema(description = "文档顺序,用于页面文档顺序显示")
        private Integer fileOrder;
        @Schema(description = "文件下载地址")
        private String downloadUrl;
        @Schema(description = "文件下载外网地址")
        private String downloadOuterUrl;
        @Schema(description = "签署完成文档fileKey的文件下载地址")
        private String signDownloadUrl;
        @Schema(description = "签署完成文档fileKey的文件下载外网地址")
        private String signDownloadOuterUrl;

    }
    @Data
    public static class FillingUserInfos {
        @Schema(description = "填写方类型：0-发起方、1-签署方")
        private Integer fillingUserType;
        @Schema(description = "签署方用户类型：1-内部，2-相对方")
        private Integer userType;
        @Schema(description = "签署方类型：1-个人，2-企业")
        private Integer signerType;
        @Schema(description = "填写方状态：0-待填写，1-填写中，2-填写完成")
        private Integer fillingStatus;
        @Schema(description = "填写时间")
        private String fillingDate;
        @Schema(description = "填写链接")
        private String fillUrl;
        @Schema(description = "填写链接（短链）")
        private String fillUrlShort;
        @Schema(description = "填写方账号信息")
        private FillingUserInfo fillingUserInfo;
        @Schema(description = "内容域实例集合")
        private List<ContentsControl> contentsControl;
    }
    @Data
    public static class FillingUserInfo {
        @Schema(description = "填写方用户编码（本系统的唯一标识）")
        private String userCode;
        @Schema(description = "填写方用户名称")
        private String userName;
        @Schema(description = "填写方用户账号（客户系统的唯一标识）")
        private String customAccountNo;
        @Schema(description = "填写方所属组织编码（本系统唯一标识）")
        private String departmentCode;
        @Schema(description = "填写方所属组织账号（客户系统的唯一标识）")
        private String customDepartmentNo;
        @Schema(description = "填写方所属组织名称")
        private String departmentName;
        @Schema(description = "填写方企业编码（本系统的唯一标识）")
        private String organizationCode;
        @Schema(description = "填写方企业账号（客户系统的唯一标识）")
        private String customOrgNo;
        @Schema(description = "填写方企业名称")
        private String organizationName;
    }
    @Data
    public static class ContentsControl {
        @Schema(description = "内容域实例名称")
        private String contentName;
        @Schema(description = "内容域参数编码")
        private String contentCode;
        @Schema(description = "填充内容")
        private String contentValue;
    }
}
